//
//  YCCollectionViewCell.m
//  瀑布流
//
//  Created by 朱永超 on 2017/3/15.
//  Copyright © 2017年 zyc. All rights reserved.
//

#import "YCCollectionViewCell.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import <Masonry.h>
@implementation YCCollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self.contentView addSubview:self.imageV];
    }
    return self;
}

-(void)setModel:(Model *)model
{
    _model = model;
    [self.imageV sd_setImageWithURL:model.url placeholderImage:[UIImage imageNamed:@"psb.jpg"]];
    [self.imageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.contentView.mas_top);
        make.left.mas_equalTo(self.contentView.mas_left);
        make.right.mas_equalTo(self.contentView.mas_right);
        make.bottom.mas_equalTo(self.contentView.mas_bottom);
    }];

}
-(UIImageView *)imageV
{
    if (!_imageV) {
        _imageV = [[UIImageView alloc] init];
        _imageV.contentMode = UIViewContentModeScaleToFill;
    }
    return _imageV;
}
@end
